<?php
$pageStart = $pPaging['start'];
$pageEnd = $pPaging['end'];
$pageCur = $pPaging['page'];
$displayPaging = $pageEnd > 1;

$paging_html = "";
if($pageStart==$pageCur){
	$paging_html .= '<span class="pagnDisabled">&laquo Previous | Page:</span>';
}else{
	$paging_html .= '<a href="javascript:'. $pPaging['pag_function'] .'('.$pPaging['prev'].', '. $pPaging['itemsPerPage'] .')" title="Go to Previous Page"><span>&laquo Previous</span></a> | Page: ';
}
if ($pageCur >3 && $pageStart >1){
	$paging_html .= '<a href="javascript:'. $pPaging['pag_function'] .'(1, '. $pPaging['itemsPerPage'] .')" title="Go to Page 1" name ="page" id="'. '1' .'"  class="page">1</a>...';
}
for ($i = $pageStart; $i <= $pageEnd; $i++)
{
    $current = ' ';
	if ($i==$pageCur){ $current = 'current'; }
	$content = $i==$pageEnd?($i==$pPaging['last']?$i."</span></a>":$i. "...</span></a>"):($i."</span></a>"."&nbsp;&nbsp;") ;
	$paging_html .= '<a href="javascript:'. $pPaging['pag_function'] .'('.$i.', '. $pPaging['itemsPerPage'] .')" title="Go to Page '.$i.'" name = "'.$current.'page" id = "'.$i.'" class="'.$current.'page"><span>'.$content;
}
if($pageEnd==$pageCur){
	$paging_html .=  " | Next &raquo;";
}else{
	$paging_html .= '<a href="javascript:'. $pPaging['pag_function'] .'('.$pPaging['next'].', '. $pPaging['itemsPerPage'] .')" title="Go to Last Page"><span> | Next &raquo;</span></a>';
}

$items_per_page_options = array("1", "2", "5", "10", "20");
?>

<div style="float:left"><?=$pPaging['total']?> product(s) found, displaying <?=$pPaging['istart']?> to <?=$pPaging['iend']?></div>
<div style="float:right">
	<span style="white-space: nowrap;">
		<span style="display: <?=$displayPaging ? 'visible' : 'none'?>" class="insidePage">
			<?=$paging_html?>
		</span>
		&nbsp;&nbsp;Show:<span>
			<select onchange="<?=$pPaging['pag_function']?>(1, this.value)">
				<?php
				foreach($items_per_page_options as $option){
					?>
						<option <?=$pPaging['itemsPerPage'] == $option? 'selected="selected"' : ''?>  value="<?=$option?>"><?=$option?></option>
					<?
				}
				?>
		   </select>
		</span> per page
	</span>
</div>
